import code
import subprocess
from nicegui import ui
from ex4nicegui import to_ref, ref_computed, effect
from ex4nicegui.reactive import rxui


def dode_check(stu,teacher):
    ts = code.code_check(stu)
    tt = code.code_check(teacher)
    if tt != True:
        ui.notify('正确代码出错: '+tt)
        return
    if ts == True and ts == tt:
        ui.notify('AC!!!')
    else:
        ui.notify(ts)

intput = to_ref('')
def ondick():
    # pass
    dode_check(intput.value,'print(2)')
with ui.card().classes("backdrop-blur-sm bg-white/30 p-10 w-[40%] gap-4 absolute-center items-center"):
    ui.label('1+1等于??')
    rxui.textarea('输入代码',value=intput)
    ui.button('提交',on_click=ondick)
ui.run()